<?php 
#echo $_SERVER["REQUEST_URI"];exit();
#print_r($HttpResult);
if(1==2){$HttpResult = new HttpResult();}

    $HttpContentResult = $HttpResult->getHttpContentResult();
    //Debug::print_r($HttpResult);
    //$lang = Config::DEFAULT_LOCALE;
    $head = new HtmlHeader($HttpContentResult->getHeader());
    $head->addCSS('reset');
    $head->addCSS('print','', 'print');
    $head->addCSS('ie',  'css/ie', 'print',true);

    $head->addCSS('forum',"css/admin");

    //<!-- PROGRAMACAO JS | JQUERY  -->
    $head->addJS(array('jquery', 'masked'));
		
    //MENU DROPDOWN
    $head->addJS('Menu principal','js/menu/ddsmoothmenu');
    $head->addCSS('Menu CSS','js/menu/ddsmoothmenu');
    
    //TINYMCE
    $head->addJS('tinymce','js/tinymce/jquery.tinymce');
    
    //FILEUPLOAD
    $head->addJS('so','js/uploadify/swfobject');
    $head->addJS('uploadify','js/uploadify/jquery.uploadify.v2.1.4.min');
    $head->addCSS('Upload CSS','js/uploadify/uploadify');
		       
    //SLIDER SHOW
    $head->addJS('cycle', 'js/cycle/jquery.cycle.min');

    //<!-- JQUERY UI  -->
    $head->addJS('UI', 'js/UI/js/jquery-ui-1.8.6.custom.min');
    $head->addCSS('UI','js/UI/css/smoothness/jquery-ui-1.8.6.custom');
		
     //SELECTMENU
    $head->addJS('selectmenu','js/UI/development-bundle/ui/jquery.ui.selectmenu');
    $head->addCSS('selectmenu CSS','js/UI/css/jquery.ui.selectmenu');
    
    //<!-- VTIP  -->
    $head->addJS('vtip', 'js/vtip/vtip');
    $head->addCSS('vtip', 'js/vtip/vtip');

    //<!-- TABLE SORTER -->
    $head->addJS('tablesorter', 'js/tablesorter/tablesorter');
    $head->addCSS('tablesorter', 'js/tablesorter/tablesorter');
    
    //<!-- PROGRAMACAO JS | JQUERY  -->
    $head->addJS(array('admin','admin_select', 'admin/money_history/list'));
		
	$header_html = $head->show(TRUE);
$header_html = str_replace(array("democrart", "democrArt", "Democrart", "DemocrArt"), array("expressaoartistica", "Expressão Artística", "Expressão Artística", "Expressão Artística"), $header_html);
echo $header_html;
		$mes = "";
		switch ($HttpContentResult->month_base_int) {
			case '1':
				$mes = "Janeiro";
			break;
			case '2':
				$mes = "Fevereiro";
			break;
			case '3':
				$mes = "Março";
			break;
			case '4':
				$mes = "Abril";
			break;
			case '5':
				$mes = "Maio";
			break;
			case '6':
				$mes = "Junho";
			break;
			case '7':
				$mes = "Julho";
			break;
			case '8':
				$mes = "Agosto";
			break;
			case '9':
				$mes = "Setembro";
			break;
			case '10':
				$mes = "Outubro";
			break;
			case '11':
				$mes = "Novembro";
			break;
			case '12':
				$mes = "Dezembro";
			break;
			
		}
			
		
?>
 
<body>

<div id="main">
      <?php include "view/democrart/parts/admin/header.php" ?>
      
	  <div id="main_content">
	  
	  <div id="msgBox"></div>
	  			
		 <div id="box_right">
			<h1>Lista Geral de Pagamentos</h1>
			<?php
			if(DataHandler::getValueByArrayIndex($HttpContentResult->arrayVariable, "filtro")){
				$filtro = DataHandler::getValueByArrayIndex($HttpContentResult->arrayVariable, "filtro");
				$busca	= DataHandler::getValueByArrayIndex($HttpContentResult->arrayVariable, "busca");
			?>
			<div id="avisoFiltro">Filtrado por: <?php echo $filtro?> "<?php echo $busca;?>" :
			<a href="<?php echo Config::getRootPath("admin/money_history");?>">
				 remover filtro <img src="<?php echo Config::getAsset("assets/img/icons/delete.jpg");?>" alt="remover filtro"></img>
			</a>
			</div>
			<?php } ?>
			
			<div style="clear:both">
				<form id="frmFilter" name="frmFilter" method="post" action="#" class="filter">
					<table>
						<tr style="display:block;">
							<td><strong>Filtrar: </strong>
								<input type="text" name="filter" id="filter" size="25" />
								<input type="hidden" name="user_type_id" id="user_type_id" value="<?php echo $HttpContentResult->user_type_id; ?>" />
							</td>
							<td>
								<select name="filter_by" id="filter_by">
									<option  value="name" selected="selected" >Nome</option>
									<option  value="email" >E-Mail</option>
								</select>
							</td>
							<td><a href="javascript:void(0);" onclick="MoneyHistory.search($('#filter').val(), $('#filter_by').val(), $('#month').val(), $('#year').val(), $('#user_type_id').val())" class="button">Filtrar</a></td>
						</tr>
					</table>
					Mes: &nbsp;
					<select name="month" id="month">
						<option value="1" <?php echo ($HttpContentResult->month_base_int == '1')?"selected='selected'":""; ?> >Janeiro</option>
						<option value="2" <?php echo ($HttpContentResult->month_base_int == '2')?"selected='selected'":""; ?> >Fevereiro</option>
						<option value="3" <?php echo ($HttpContentResult->month_base_int == '3')?"selected='selected'":""; ?> >Março</option>
						<option value="4" <?php echo ($HttpContentResult->month_base_int == '4')?"selected='selected'":""; ?> >Abril</option>
						<option value="5" <?php echo ($HttpContentResult->month_base_int == '5')?"selected='selected'":""; ?> >Maio</option>
						<option value="6" <?php echo ($HttpContentResult->month_base_int == '6')?"selected='selected'":""; ?> >Junho</option>
						<option value="7" <?php echo ($HttpContentResult->month_base_int == '7')?"selected='selected'":""; ?> >Julho</option>
						<option value="8" <?php echo ($HttpContentResult->month_base_int == '8')?"selected='selected'":""; ?> >Agosto</option>
						<option value="9" <?php echo ($HttpContentResult->month_base_int == '9')?"selected='selected'":""; ?> >Setembro</option>
						<option value="10" <?php echo ($HttpContentResult->month_base_int == '10')?"selected='selected'":""; ?> >Outubro</option>
						<option value="11" <?php echo ($HttpContentResult->month_base_int == '11')?"selected='selected'":""; ?> >Novembro</option>
						<option value="12" <?php echo ($HttpContentResult->month_base_int == '12')?"selected='selected'":""; ?> >Dezembro</option>
					</select>
					<br />
					Ano: &nbsp;
					<select name="year" id="year">
						<?php 
						$ano_atual = date("Y", time());
						for($i = 2011; $i <= $ano_atual; $i++){
							?>
							<option value="<?php echo $i;?>" <?php if($i == $ano_atual) echo " selected=selected "; ?>><?php echo $i;?></option>
							<?php 
						}
						?>
					</select>
					
				</form>
				<br />
				<h2>Mes Selecionado: <?php echo $HttpContentResult->month_base_int; ?></h2>
				<h2>Ano Selecionado: <?php echo $HttpContentResult->year_base; ?></h2>
				<span class="count"><?php echo $HttpContentResult->count_total; ?> registro(s)</span>
				<table class="tablesorter">
					<thead>
						<tr>
							<th>Data</th>
							<th>Parceiro</th>
							<th>E-Mail</th>
							<th>Titulo</th>
							<th>Valor</th>
							<th>Editar</th>
							<th>Excluir</th>
						</tr>
					</thead>
					<tbody>
					<?php
					if(count($HttpContentResult->arrayHistorys) > 0){
						//tem resultados a mostrar 
//						Debug::print_r($HttpContentResult->arrayHistorys);exit();
						foreach($HttpContentResult->arrayHistorys as $historys){
						?>
						<tr id="user_<?php echo $historys->id ?>">
							<td><?php echo $historys->date_in; ?></td>
							<td><?php echo $historys->name; ?></td>
							<td><?php echo $historys->email; ?></td>
							<td><?php echo $historys->title; ?></td>
							<td><?php echo DataHandler::convertMoneyToBrazil($historys->value); ?></td>
							<td class="ico"><a href="<?php echo Config::getRootPath("admin/money_history/update/id.".$historys->id) ?>">
							<img id="edit1" src="<?php echo Config::getAsset("assets/img/icons/edit.jpg");?>" alt="Editar" title="" /></a></td>
							<td class="ico">
                                <a class="del del_money_history" 
                                   name="user" 
                                   id="<?php echo $historys->id ?>" 
                                   href="<?php echo Config::getRootPath("admin/money_history/delete/id.".$historys->id) ?>">
                                    <img id="del1" src="<?php echo Config::getAsset("assets/img/icons/delete.jpg");?>" alt="Excluir" title="" />
                                </a>
                            </td>
						</tr>
					<?php 
						}//end foreach
					} else {
						//aqui não tem resultados a mostrar
					?>
					<tr id="user_0">
							<td colspan="7">Nenhum resultado encontrado</td>
						</tr>
					<?php }?>
					</tbody>
				</table>
			</div>
			
			<!-- COMECO PAGINACAO -->
			<div style="clear: both;"></div>
			<div id="model-pagination" style="text-align: center;padding: 20px 0px 20px 0px;">
			<?php 
				include_once("library/facil3/utils/Pagination.class.php");
				$Pagination = new Pagination($HttpContentResult->page, $HttpContentResult->limit_page, $HttpContentResult->count_total);
				$htmlPaginacao = $Pagination->getHtml();
				echo $htmlPaginacao;
			?>
			
			</div>
		
		</div>
					
			
			<!-- FIM DO QUADRO -->
	
	</div>
	
</div>

</body>
</html>
